#include<iostream>
#include<cstring>
#include<vector>
int StringSpilt(const std::string& str,const std::string& seq,std::vector<std::string>& str_array)
{
    if (seq.empty()) {
        // 如果分隔符为空，直接将整个字符串作为结果
        str_array.push_back(str);
        return str_array.size();
    }

    int pos=0,idx=0;
    while(idx<str.size())
    {
        pos=str.find(seq,idx);
        if(pos==std::string::npos){
           str_array.push_back(str.substr(idx));
           return str_array.size();
        }
        else{
            if(pos==idx){
                idx=pos+seq.size();
            }
            else{
               str_array.push_back(str.substr(idx,pos-idx));
               idx=pos+seq.size();
            }
        }
    }
    return str_array.size();
}
int main()
{
    std::string str = "...news....music.#.pop...";
    std::vector<std::string> arry;
    int n = StringSpilt(str, ".", arry);
    for (auto &s : arry) {
        std::cout << s << std::endl;
    }
    return 0;
}